package com.xiaowu.datajpa.controller;

import com.xiaowu.datajpa.entity.Student;
import com.xiaowu.datajpa.entity.Teacher;
import com.xiaowu.datajpa.service.StudentSercvice;
import com.xiaowu.datajpa.service.TeacherSercvice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    private TeacherSercvice teacherSercvice;
    @GetMapping("/list")
    public String getList(Model model){
        List<Teacher> teachers = teacherSercvice.findAll();
        model.addAttribute("list",teachers);
        return "/teacher/list1";
    }
}
